package cn.huaqingcheng.tianshu.mybatis;

import org.springframework.dao.OptimisticLockingFailureException;

/**
 * OptimisticLockTool
 */
public interface OptimisticLockTool {

    static void assertion(int i, Integer version) {
        if (i <= 0) {
            throw new OptimisticLockingFailureException("version = " + version);
        }
    }

    static void assertion(boolean update, Integer version) {
        if (!update) {
            throw new OptimisticLockingFailureException("version = " + version);
        }
    }

}
